#! /bin/bash

########################################################################
# enable support to mdev in the busybox
# when making rootfs:
# Linux System Utilities  --->   
#       [*] mdev      
#       [*]   Support /etc/mdev.conf
#       [*]     Support command execution at device addition/removal
#
# And add the content to rcS in /etc/init.d directory,
# which could be found in doc/mdev.txt in the busybox.
#########################################################################

mount -t tmpfs mdev  /dev 
mount -t sysfs sysfs /sys
mkdir /dev/pts
mount -t devpts devpts /dev/pts

# use mdev to substitue '/sbin/hotplug' when hotplug event happen.
# mdev checks /sys directory changes by using ACTION and DEVPATH
# environment variables to create or remove device node.
echo /sbin/mdev >/proc/sys/kernel/hotplug

# -s indicates 'scan',mdev scan class device directory in the
# /sys/class and /sys/block, if the device directory has 'dev' file
# and its content is device major:minor node number,then mdev
# creates dev-node-file in the /dev directroy.
# 
# it only runs once on starting in general.
#
mdev –s

